package com.zlzlib.libuimodel.ui;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.ViewModelProvider;

import com.zlzlib.libuimodel.model.BaseViewModel;
import com.zlzlib.libuimodel.model.RxDataModel;

/**
 * @Desc:
 * @Copyright:
 * @DateTime: 2021/8/20 15:41
 * @Author zlz
 * @Version 1.0
 */
public class Utils {

    public static <T extends BaseViewModel<? extends RxDataModel>> T getBaseViewModel(Fragment fragment, Class<T> tClass) {
        return new ViewModelProvider(fragment).get(tClass);
    }

    public static <T extends BaseViewModel<? extends RxDataModel>> T getBaseViewModel(FragmentActivity activity, Class<T> tClass) {
        return new ViewModelProvider(activity).get(tClass);
    }

}
